home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 016a / ps2drvtb.zip / DRIVETBL.C next >
C/C++ Source or Header  |  1990-10-04  |  2KB  |  71 lines

  1. /****************************************************************************/
  2. /* Program:          DRIVETBL                                               */
  3. /* Author:           Greg Thielen, Innovative Systems Design                */
  4. /* Date written:     October 4, 1990                                        */
  5. /* Compiler:         Microsoft C 6.0                                        */
  6. /* Description:      Display Fixed Disk Drive Table.                        */
  7. /****************************************************************************/
  8.  
  9. #pragma pack(1)
  10.  
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include <dos.h>
  14.  
  15. char   *version   = "DRIVETBL  Version 1.00";
  16. char   *copyright = "(C) Copyright Innovative Systems Design, 1990";
  17.  
  18. void   tbl_detail(int, struct DRIVE_TBL _far *);
  19.  
  20. struct DRIVE_TBL {
  21.   int  cyl;
  22.   char heads;
  23.   int  rsv1;
  24.   int  precomp;
  25.   char rsv2;
  26.   char cntrl;
  27.   char rsv3;
  28.   char rsv4;
  29.   char rsv5;
  30.   int  land;
  31.   char sect;
  32.   char rsv6;
  33. };
  34.  
  35. main()
  36. {
  37.   int  x;
  38.   struct DRIVE_TBL _far *ptr;
  39.  
  40.   printf("      Number of  Number    Number Write     Landing  Number      Formatted\n");
  41.   printf("Type  Cylinders  of Heads  Precompensation  Zone     of Sectors  Capacity\n");
  42.  
  43.   printf("\n------------------------- Installed Drive Types --------------------------\n");
  44.   ptr = (struct DRIVE_TBL _far *) _dos_getvect(0x41);
  45.   tbl_detail(0, ptr);
  46.  
  47.   ptr = (struct DRIVE_TBL _far *) _dos_getvect(0x46);
  48.   tbl_detail(1, ptr);
  49.  
  50.   FP_SEG(ptr) = 0xE000;      /* Segment and offset to drive table entry 1 */
  51.   FP_OFF(ptr) = 0x025D;
  52.  
  53.   printf("\n-------------------------- Drive Table Entries ---------------------------\n");
  54.   for (x = 1; x < 34; x++)
  55.   {
  56.     tbl_detail(x, ptr++);
  57.   }
  58.  
  59.   exit(0);
  60. }
  61.  
  62. void tbl_detail(int x, struct DRIVE_TBL _far *ptr)
  63. {
  64.   long fmtcap;
  65.  
  66.   fmtcap = (long) (ptr->heads * ptr->cyl) * (long) (ptr->sect * 512) / 1000000L;
  67.   printf(" %3i    %5i      %3i         %5i        %5i      %3i       %5liM\n",
  68.          x, ptr->cyl, ptr->heads, ptr->precomp, ptr->land, ptr->sect, fmtcap);
  69.   return;
  70. }
  71.